package com.totem.customer.controller;

import cn.hutool.core.lang.Assert;
import com.totem.base.model.PageVO;
import com.totem.base.model.Result;
import com.totem.base.mybatis.controller.BaseController;
import com.totem.customer.api.ITTrackServiceApi;
import com.totem.customer.model.TTracks;
import com.totem.customer.serivce.ITTrackService;
import com.totem.customer.vo.AddTrackVO;
import com.totem.customer.vo.TrackPageVO;
import com.totem.product.vo.ProductVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class TrackController extends BaseController<ITTrackService, TTracks> implements ITTrackServiceApi {
    @Override
    public Result<Boolean> add(AddTrackVO vo) {
        Assert.notNull(vo.getProductId(), "产品Id必填");
        return Result.result("添加足迹信息成功", "添加足迹信息失败", service.addTrack(vo));
    }

    @Override
    public Result<PageVO<ProductVO>> trackPage(TrackPageVO vo) {
        return Result.success(service.trackPage(vo));
    }
}
